package com.stoken.dao;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.stoken.domain.MemberLeaveMessage;
import com.stoken.domain.TravelLeaveMessage;
import com.symbio.commons.Page;
import com.symbio.dao.hibernate.GenericDaoImpl;
import com.symbio.utils.HibernateUtils;

@Repository
public class TravelLeaveMessageDao extends GenericDaoImpl<TravelLeaveMessage, Long> {
	
	public Page<TravelLeaveMessage> findListByPid(Page<TravelLeaveMessage> pageData,long bId){		
		
		Criteria criteria = HibernateUtils.createCriteria(getSession(), entityClass);
		
		criteria.createAlias("baseUsername", "baseUsername",Criteria.INNER_JOIN, Restrictions.eq("baseUsername.id", bId)); 	
	
		
		HibernateUtils.setParameter(criteria, pageData);
		
		pageData.setResult(criteria.list());
		
		return pageData;		
	}
}
